<template>
  <div>
    <el-table
      style="margin-top: 10px;"
      :data="list"
      border
    >
      <el-table-column align="center" width="100px" label="选择">
        <template slot-scope="scope">
          <el-radio
            :value="scope.row.roomID"
          />
        </template>
      </el-table-column>
      <el-table-column align="center" label="序号">
        <template slot-scope="scope">
          <span>
          {{ scope.row.roomID }}
            </span>
        </template>
      </el-table-column>
      <el-table-column label="会议室名称" align="center">
        <template slot-scope="scope">
          {{ scope.row.roomName }}
        </template>
      </el-table-column>
      <el-table-column align="center" prop="created_at" label="会议室描述">
        <template slot-scope="scope">
          <span>{{ scope.row.description }}</span>
        </template>
      </el-table-column>
      <el-table-column class-name="status-col" label="操作" align="center">
        <template slot-scope="scope">
          <el-button
            size="small"
            @click="xg(scope.row.roomID)">
            修改
          </el-button>
          <el-button
            size="small"
            type="danger"
            @click="handleDelete(scope.row.roomID)"
          >
            删除
          </el-button>
        </template>
      </el-table-column>
    </el-table>
    <el-pagination
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="this.pageNum"
      :page-size="this.pageSize"
      layout="total, sizes, prev, pager, next, jumper"
      :total="this.total"
      :page-sizes="[5, 10, 20]"
    />
  </div>
</template>

<script>

import {getConferenceRoomManagement} from "@/api/conferenceRoom/ConferenceRoomManagement/table";

export default {
  data() {
    return {
      total: 0,
      pages: 0,
      pageSize: 5,
      pageNum: 1,
      list: [],
      MeetingroombookingList: {},
    }
  },
  created() {
    this.fetchData();
  },
  methods: {
    handleSizeChange(val) {
      this.pageSize = val;
      this.fetchData();
    },
    handleCurrentChange(val) {
      this.pageNum = val;
      this.fetchData();
    },
    fetchData() {
      getConferenceRoomManagement(this.pageNum, this.pageSize, this.MeetingroombookingList).then(response => {
        this.total = response.data.total
        this.pages = response.data.pages
        this.list = response.data.list
      })
    },
  }
}
</script>

